<?php 

    namespace Home\Model;
    use Think\Model;
    class UserModel extends Model {

	public function checkEmail($email)
	{

		// $sql  = "select * from user where email='{$email}'";
		// $res= $this->query($sql);
		$res = $this->where("email='{$email}'")->find();
		return $res;

	}
	public function checkNickname($nickname)
	{
		$res = $this->where("nickname='{$nickname}'")->find();
	
		return $res;
	}

	// public function checkLogin($password,$email)
	// {
	// 	$password = md5($password);
	// 	$sql  = "select * from user where email='{$email}' and password = '{$password}'";
	// 	$res= $this->query($sql);
	// 	return $res;
	// }
	public function checkLogin($email,$password)
	{
		// $password = md5($password);
		
		// $sql ="select * from user where email='{$email}' and password= '{$password}'";

		// $this->query($sql);

		$data = array(
			'email'=>$email,
			'password'=>md5($password)
			);
		return $this->where($data)->find();
	}


    }






















 ?>